﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Choose a game</title>
</head>

<body>
<script src="http://opensocialapps.googlecode.com/svn/trunk/games/script.js"></script>
      <script>
        gadgets.util.registerOnLoadHandler(init);
      </script>
	<script type="text/javascript">
		
		    function makeNormalRequest(name) {   
		    	var url = getURLFromGameName(name);
		    	
		      document.getElementById('content_div').innerHTML = 
		      "<a href=\"JavaScript:void(0);\" onclick=\"backToGames()\">Back to games</a><br/><embed src=\"" + url + "\" type=\"application/x-shockwave-flash\" height=\"350\" width=\"100%\"></embed>";   		      
		      document.getElementById('currentgame').innerHTML = name;
		      
				HideContent('games');
				ShowContent('gameview');
				ShowContent('content_div');
		    };
		    
		    function backToGames() {    
				HideContent('content_div');
				HideContent('gameview');
				ShowContent('games');
				
				document.getElementById('content_div').innerHTML = "";
		    };
		
			function HideContent(d) {
			if(d.length < 1) { return; }
			document.getElementById(d).style.display = "none";
			}
			
			function ShowContent(d) {
			if(d.length < 1) { return; }
			document.getElementById(d).style.display = "block";
			}
		    </script>
	<div id="games">
		Choose a game:
		<table style="width: 100%" align="center">
			<tr>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Mario Game" src="mario.png" width="120" height="60" onclick="makeNormalRequest('Mario')" /></a></td>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Chess Game" src="chess.png" width="120" height="60" onclick="makeNormalRequest('Chess')" /></a></td>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Chess Game" src="copter.png" width="120" height="60" onclick="makeNormalRequest('Copter')"  /></a></td>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Duck Hunt Game" src="duckhunt.png" width="120" height="60" onclick="makeNormalRequest('Duck Hunt')"/></a></td>
			</tr>
			<tr>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Simon Memory Game" src="simon.png" width="120" height="60" onclick="makeNormalRequest('Simon')" /></a></td>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Sonic Game" src="sonic.png" width="120" height="60" onclick="makeNormalRequest('Sonic')" /></a></td>
				<td>
				<a href="JavaScript:void(0);">
				<img alt="Play Tic-Tac-Toe Game" src="tic-tac-toe.png" width="120" height="60" onclick="makeNormalRequest('Tic-Tac-Toe')"/></a></td>
				<td>or select a game<form method="post">
					<select id="games_choice" name="games_choice" onchange="selectionChanged()">
					<option value="Asteroids">
					Asteroids</option>
					<option selected="selected" value="Squares">Squares
					</option>
					</select></form>
				</td>
			</tr>
		</table>
	</div>
	<div id="gameview" style="display:none">
		<div id="content_div">
		</div>
		<form id="gift_form">
			Recommend this game to <span id="friends"></span>
			<a href="javascript:void(0);" onclick="giveGame();">
			Recommend!</a>
		</form>
	</div>
	<div id="currentgame" style="visibility: hidden">
	</div>
	<div id="given">
	</div>
	<div id="received">
	</div>
</body>

</html>